package hu.lacimol.tutorial.todo.action;

import hu.lacimol.tutorial.todo.service.TodoService;


public class DeleteTodoAction extends TodoAction {

	private static final long serialVersionUID = -5096207440673295940L;

	public DeleteTodoAction(TodoService todoService) {
		super(todoService);
	}

	@Override
	protected String doExecute() throws Exception {
		final String id = request.getParameter("key");
		this.todoService.delete(Integer.valueOf(id));

		return getRedirect(VIEW_PAGE);
	}

	@Override
	public void doValidation() {
		doKeyValidation();
	}

}